package org.scboy.coobi.caches;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

import org.scboy.utils.entitys.coobi.DbTable;

/**
 * 
 * 数据配置表缓存
 * 
 * @author yanghao
 *
 */
public class DbTableCache {
	
	/**
	 * 表配置缓存
	 */
	private static Map<String, DbTable> cacheData=new HashMap<String, DbTable>();
	
	/**
	 * 
	 * 表配置加入缓存
	 * 
	 * @param tableName
	 * @param dbTable
	 */
	public static void setDbTable(String tableName,DbTable dbTable) {
		cacheData.put(tableName, dbTable);
	}

	/**
	 * 获取缓存中的表配置
	 * @param tableName
	 * @return
	 */
	public static DbTable getDbTable(String tableName) {
		return cacheData.get(tableName);
	}
	
	/**
	 * 检查表是否存在
	 * @param tableName
	 * @return
	 */
	public static boolean check(String tableName) {
		return cacheData.containsKey(tableName);
	}
	
	/**
	 * 获取所有表配置
	 * @return
	 */
	public static Collection<DbTable> getDbTables() {
		return cacheData.values();
	}
}
